package o;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.Since;
import com.google.gson.annotations.Until;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public final class atw implements ats, Cloneable {
    public static final atw ˋ = new atw();
    private List<asx> ʻ = Collections.emptyList();
    private List<asx> ʼ = Collections.emptyList();
    private double ˊ = -1.0d;
    private boolean ˎ = true;
    private boolean ˏ;
    private int ॱ = 136;

    protected /* synthetic */ Object clone() throws CloneNotSupportedException {
        return ˋ();
    }

    protected atw ˋ() {
        try {
            return (atw) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new AssertionError(e);
        }
    }

    public atw ˎ(asx o_asx, boolean z, boolean z2) {
        atw ˋ = ˋ();
        if (z) {
            ˋ.ʼ = new ArrayList(this.ʼ);
            ˋ.ʼ.add(o_asx);
        }
        if (z2) {
            ˋ.ʻ = new ArrayList(this.ʻ);
            ˋ.ʻ.add(o_asx);
        }
        return ˋ;
    }

    public <T> ato<T> ˎ(atb o_atb, auv<T> o_auv_T) {
        boolean z = false;
        Class ˋ = o_auv_T.ˋ();
        boolean ˋ2 = ˋ(ˋ);
        final boolean z2 = ˋ2 || ˋ(ˋ, true);
        if (ˋ2 || ˋ(ˋ, false)) {
            z = true;
        }
        if (!z2 && !z) {
            return null;
        }
        final atb o_atb2 = o_atb;
        final auv<T> o_auv_T2 = o_auv_T;
        return new ato<T>(this) {
            final /* synthetic */ atw ˋ;
            private ato<T> ᐝ;

            public T ˏ(auy o_auy) throws IOException {
                if (!z) {
                    return ˎ().ˏ(o_auy);
                }
                o_auy.ˋॱ();
                return null;
            }

            public void ˎ(aux o_aux, T t) throws IOException {
                if (z2) {
                    o_aux.ᐝ();
                } else {
                    ˎ().ˎ(o_aux, t);
                }
            }

            private ato<T> ˎ() {
                ato<T> o_ato_T = this.ᐝ;
                if (o_ato_T != null) {
                    return o_ato_T;
                }
                o_ato_T = o_atb2.ˋ(this.ˋ, o_auv_T2);
                this.ᐝ = o_ato_T;
                return o_ato_T;
            }
        };
    }

    public boolean ˋ(Field field, boolean z) {
        if ((this.ॱ & field.getModifiers()) != 0) {
            return true;
        }
        if (this.ˊ != -1.0d && !ˏ((Since) field.getAnnotation(Since.class), (Until) field.getAnnotation(Until.class))) {
            return true;
        }
        if (field.isSynthetic()) {
            return true;
        }
        if (this.ˏ) {
            Expose expose = (Expose) field.getAnnotation(Expose.class);
            if (expose == null || (z ? !expose.serialize() : !expose.deserialize())) {
                return true;
            }
        }
        if (!this.ˎ && ॱ(field.getType())) {
            return true;
        }
        if (ˎ(field.getType())) {
            return true;
        }
        List<asx> list = z ? this.ʼ : this.ʻ;
        if (!list.isEmpty()) {
            ata o_ata = new ata(field);
            for (asx shouldSkipField : list) {
                if (shouldSkipField.shouldSkipField(o_ata)) {
                    return true;
                }
            }
        }
        return false;
    }

    private boolean ˋ(Class<?> cls) {
        if (this.ˊ != -1.0d && !ˏ((Since) cls.getAnnotation(Since.class), (Until) cls.getAnnotation(Until.class))) {
            return true;
        }
        if (!this.ˎ && ॱ((Class) cls)) {
            return true;
        }
        if (ˎ(cls)) {
            return true;
        }
        return false;
    }

    public boolean ˊ(Class<?> cls, boolean z) {
        return ˋ(cls) || ˋ((Class) cls, z);
    }

    private boolean ˋ(Class<?> cls, boolean z) {
        for (asx shouldSkipClass : z ? this.ʼ : this.ʻ) {
            if (shouldSkipClass.shouldSkipClass(cls)) {
                return true;
            }
        }
        return false;
    }

    private boolean ˎ(Class<?> cls) {
        return !Enum.class.isAssignableFrom(cls) && (cls.isAnonymousClass() || cls.isLocalClass());
    }

    private boolean ॱ(Class<?> cls) {
        return cls.isMemberClass() && !ˏ(cls);
    }

    private boolean ˏ(Class<?> cls) {
        return (cls.getModifiers() & 8) != 0;
    }

    private boolean ˏ(Since since, Until until) {
        return ॱ(since) && ॱ(until);
    }

    private boolean ॱ(Since since) {
        if (since == null || since.value() <= this.ˊ) {
            return true;
        }
        return false;
    }

    private boolean ॱ(Until until) {
        if (until == null || until.value() > this.ˊ) {
            return true;
        }
        return false;
    }
}
